package cate.game.train.awakenfairy.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "觉醒灵器回炉 の 请求")
@OperationSetter(GDOperation.AWAKEN_FAIRY_BACK)
public class AwakenFairyBackReq implements MsgInput {
    @NoteField(value = "觉醒灵器唯一id")
    public String awakenFairyUid;

    @NoteField(value = "英雄ID", detail = "如果是背包里灵器的就不用传")
    public String heroUid;

    @NoteField(value = "部位", detail = "如果是背包里灵器的就不用传")
    public byte pos;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.awakenFairy.back(cc.getRole(), awakenFairyUid, heroUid, pos);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.AWAKEN_FAIRY_BACK_REQ;
    }
}
